/*
 * Text.java
 *
 * Created on December 6, 2006, 6:26 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.netbeans.modules.manifesteditor.editor;

import java.awt.EventQueue;
import java.awt.Image;
import org.netbeans.core.spi.multiview.MultiViewDescription;
import org.netbeans.core.spi.multiview.MultiViewElement;
import org.netbeans.modules.manifesteditor.*;
import org.openide.util.HelpCtx;
import org.openide.windows.TopComponent;

/**
 *
 * @author Geertjan Wielenga
 */
public class ManifestTextView implements MultiViewDescription {
    
    private ManifestSourceEditor editor;
    private ManifestEditorSupport support;
    
    public ManifestTextView(ManifestEditorSupport ed) {
        this.support = ed;
    }
    
    public int getPersistenceType() {
        return TopComponent.PERSISTENCE_ONLY_OPENED;
    }
    
    public String getDisplayName() {
        return "Text";
    }
    
    public Image getIcon() {
        return null;
    }
    
    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;
    }
    
    public String preferredID() {
        return "text";
    }
    
    public MultiViewElement createElement() {
        return getEd();
    }
    
    private ManifestSourceEditor getEd() {
        assert EventQueue.isDispatchThread();
        if (editor == null) {
            editor = new ManifestSourceEditor(support);
        }
        return editor;
    }
    
}